<template>
    <div id="form">
        <div class="container">
            <div class="content" v-show="isLogin[userId]">
                <div class="hint">
                    <span>还有未评价的订单哦，点击去评价</span>
                    <div class="close"></div>
                </div>
                <div class="list">
                    <div class="order underway more" v-for="(val,key,index) in checkIdArr2" :key="index" v-if="checkIdArr2[key][checkIdArr2[key].length-1].shifu">
                        <h2 v-if="val2.id==key" v-for="val2 in shopArry" :key="val2.id">
                            <span class="name">{{val2.shopNameTitle1}}{{val2.shopNameTitle2}}</span>
                            <i class="fa fa-angle-right"></i>
                            <span class="status">进行中</span>
                        </h2>
                        <p class="time">今天 18:04</p>
                        <div class="item">
                            <div class="sendStatus">
                                <div class="phone"></div>
                                <div class="senderInfo">
                                    <h4>配送员已抢单</h4>
                                    <p>配送员正在前往商家，配送员：洪在烈</p>
                                </div>
                            </div>
                        </div>
                        <div class="goods">
                            <div class="gdImgWrap">
                                <div class="gdImg" v-for="(val3,index) in val" :key="val3.id" v-if='!val3.shifu&&index<=3'>
                                    <img :src="imgUrl+val3.img">
                                </div>
                                <div class="omit gdImg" v-if="checkIdArr2[key].length>=5"></div>
                            </div>
                            <div class="total">
                                <div class="price">￥{{checkIdArr2[key][checkIdArr2[key].length-1].shifu}}</div>
                                <div class="num">共{{checkIdArr2[key][checkIdArr2[key].length-1].totalNum}}件</div>
                                <div class="dada">
                                    <span>达达专送</span>
                                </div>
                            </div>
                        </div>
                        <div class="hr"></div>
                    </div>
                    <div class="order off">
                        <h2>
                            <span class="name">沃尔玛-秦淮店</span>
                            <i class="fa fa-angle-right"></i>
                            <span class="status">已完成</span>
                        </h2>
                        <p class="time">今天 18:04</p>
                        <div class="item">
                            <div class="sendStatus">
                                <div class="phone"></div>
                                <div class="senderInfo">
                                    <h4></h4>
                                    <p></p>
                                </div>
                            </div>
                        </div>
                        <div class="goods">
                            <div class="gdImgWrap">
                                <div class="gdImg" v-for="val4 in arry" :key="val4.id">
                                    <img :src="imgUrl+val4.arr">
                                </div>
                            </div>
                            <div class="total">
                                <div class="price">￥23.2</div>
                                <div class="num">共3件</div>
                                <div class="dada">
                                    <span>达达专送</span>
                                </div>
                            </div>
                        </div>
                        <div class="eva">
                            <div class="btns">
                                <div class="btn">去评价</div>
                                <div class="btn">再次购买</div>
                            </div>
                        </div>
                        <div class="hr"></div>
                    </div>
                    <div class="tip">已显示全部</div>
                </div>
            </div>
            <div class="emptyForm" v-show="!isLogin[userId]">
                <div class="emptyTxt">
                    <p>登录后才能查看订单哦</p>
                    <router-link to='/login' class="tipBtn">立即登录</router-link>
                </div>
            </div>
        </div>
        <AppFooter active='formTab'></AppFooter>
    </div>
</template>

<script>
import $ from 'jquery'
export default {
    data(){
        return {
            shopArry:[],
            arry:[],
        }
    },
    created(){
        this.getShop();
        this.getThree();
    },
    computed:{
        userId(){
            for(let key in this.isLogin){
                if(this.isLogin[key]){
                    return key;
                }
            }
        }
    },
    methods:{
        getShop(){
            this.axios.get('/shop').then((ret)=>{
            let {data,error}=ret.data;
            this.shopArry=data;
            }).catch(()=>{})
        },
        getThree(){
            this.axios.get('/three').then((ret)=>{
            let {data,error}=ret.data;
            this.arry=data;
            }).catch(()=>{})
        },
    }
}
</script>

<style scoped lang='scss'>
#form {
    height: 1331px;
    background-color: #f4f4f4;
    .container {
        background: #f4f4f4;
        .content {
            background-color: #fff;
            .hint {
                width: 750px;
                text-align: center;
                background-color: #fbf9e4;
                position: relative;
                height: 70px;
                line-height: 70px;
                &::before {
                    height: 2px;
                    content: '';
                    width: 750px;
                    border-bottom: 2px solid #e2d1ad;
                    position: absolute;
                    bottom: -2px;
                    right: 0;
                    z-index: 10;
                }
                span {
                    color: #ee7a12;
                    font-size: 26px;
                }
                .close {
                    position: absolute;
                    right: 0;
                    top: 7px;
                    background: url(/static/form/order_status_map_icon_v46.png) no-repeat;
                    background-size: 1094px 356px;
                    width: 63px;
                    height: 63px;
                    background-position: -236px -236px;
                }
            }
            .list {
                width: 750px;
                .order {
                    color: #333;
                    background-color: #fff;
                    padding: 0 23px 35px;
                    border-bottom: 19px solid #f4f4f4;
                    h2 {
                        height: 79px;
                        font-size: 35px;
                        background-size: 103px auto;
                        padding-right: 234px;
                        white-space: nowrap;
                        line-height: 93px;
                        margin: 0;
                        position: relative;
                        .name {
                            display: inline-block;
                            max-width: 90%;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                            overflow: hidden;
                            font-weight: bold;
                            line-height: 93px;
                        }
                        i {
                            font-size: 45px;
                            position: relative;
                            top: -30px;
                            left: 2px;
                            color: #333;
                        }
                        .status {
                            position: absolute;
                            right: 0;
                            width: 215px;
                            text-align: right;
                            font-size: 30px;
                            font-weight: normal;
                        }
                    }
                    .time {
                        color: #999;
                        line-height: 1;
                        font-size: 24px;
                        margin: 0;
                    }
                    .goods {
                        margin-top: 23px;
                        position: relative;
                        .gdImgWrap {
                            width: 540px;
                            max-height: 119px;
                            overflow: hidden;
                            position: relative;
                            .gdImg {
                                display: inline-block;
                                position: relative;
                                vertical-align: middle;
                                width: 97px;
                                height: 97px;
                                margin: 11px 0 11px 11px;
                                img{
                                    width: 100%;
                                    height: 100%;
                                }
                            }
                            .omit {
                                background: url(/static/shop/ddd.png) left 56px no-repeat;
                                background-size: 50px 11px;
                                position: absolute;
                                right: 0;
                            }
                        }
                        .total {
                            width: 129px;
                            position: absolute;
                            right: 0;
                            top: 50%;
                            transform: translateY(-50%);
                            .price {
                                font-size: 35px;
                                color: #ff5757;
                                height: 44px;
                                padding-left: 59px;
                                float: right;
                            }
                            .num {
                                font-size: 30px;
                                color: #666;
                                padding-bottom: 10px;
                                float: right;
                            }
                            .dada {
                                color: #16a9ff;
                                line-height: 18px;
                                background-color: #fff;
                                box-sizing: border-box;
                                border: 3px solid #16a9ff;
                                padding: 4px 7px;
                                font-size: 23px;
                                height: 32px;
                                border-radius: 9px 2px;
                                z-index: 1;
                                float: right;
                            }
                        }
                    }
                } // .more{
                // }
                .underway {
                    .hr {
                        padding-top: 35px;
                    }
                    .status {
                        color: #47b34f;
                    }
                    .item {
                        .sendStatus {
                            font-size: 30px;
                            color: #999;
                            background-color: #fafafa;
                            margin-top: 23px;
                            position: relative;
                            padding-right: 70px;
                            .phone {
                                width: 65px;
                                height: 65px;
                                background: url(/static/form/phone.png) no-repeat;
                                background-size: 100% 100%;
                                margin-right: 23px;
                                position: absolute;
                                right: 0;
                                top: 50%;
                                margin-top: -32px;
                            }
                            .senderInfo {
                                padding: 23px;
                                position: relative;
                                line-height: 1.6;
                                &::before {
                                    border: 23px solid transparent;
                                    border-top-width: 2px;
                                    border-bottom-color: #fafafa;
                                    position: absolute;
                                    width: 0;
                                    height: 0;
                                    content: '';
                                    top: -25px;
                                    right: -23px;
                                }
                                h4 {
                                    color: #484848;
                                    font-size: 35px;
                                    margin: 0;
                                    font-weight: normal;
                                }
                                p {
                                    margin: 0;
                                    font-size: 30px;
                                    color: #999;
                                }
                            }
                        }
                    }
                }
                .off {
                    .eva {
                        padding-top: 35px;
                        .btns {
                            margin-left: 390px;
                            .btn {
                                display: inline-block;
                                margin-left: 23px;
                                padding: 14px 18px;
                                color: #333;
                                border: 2px solid #d9d9d9;
                                border-radius: 4px;
                                text-align: center;
                                font-size: 28px;
                                &:first-child {
                                    margin-left: 0;
                                }
                            }
                        }
                    }
                }
                .tip {
                    line-height: 93px;
                    text-align: center;
                    font-size: 32px;
                    color: #333;
                }
            }
        }
        .emptyForm {
            min-height: 1331px;
            background: url(/static/home/unlogin.png) center no-repeat;
            background-size: 224px 224px;
            position: relative;
            transform: translateY(-210px);
            .emptyTxt {
                position: absolute;
                top: 50%;
                padding-top: 147px;
                text-align: center;
                width: 100%;
                font-size: 35px;
                line-height: 1;
                color: #666;
                p {
                    margin: 0;
                    padding: 0;
                }
                .tipBtn {
                    text-decoration: none;
                    display: inline-block;
                    margin-top: 18px;
                    padding: 23px 18px;
                    line-height: 1;
                    border-radius: 7px;
                    border: 3px solid #47b34f;
                    background: #fff;
                    color: #47b34f;
                }
            }
        }
    }
}
</style>
